package frankenstein.algo;
import java.io.*;
import java.util.*;

import frankenstein.datastructures.Scenario;

public class AddingScenario extends Scenario {

	Integer respToAdd;
	ArrayList<Integer> preferences = new ArrayList<Integer>();
	
	
	public AddingScenario(String description, Integer resp, double probability, boolean dynamicEffect, boolean staticEffect, boolean implement, boolean semantic){
		
		this.scenarioDescription = description;
		this.respToAdd = resp;
		this.setScenarioPreferences();
		this.setScenarioPreferences(preferences);
		this.responsibility = resp;
		this.dispatcherCoefficient = 1.0;
		this.serverCoefficient = 3.0;
		this.scenarioProbability = probability;
		this.proxyCoefficient = 1.0;
		this.type = Scenario.ADD;
		this.dynamicEffect = dynamicEffect;
		this.staticEffect = staticEffect;
		this.implementationalChange = implement;
		this.semanticChange = semantic;
	}
	
	public Integer getResponsibility(){
		return respToAdd;
	}
	public ArrayList<Integer> getScenarioPreferences(){
		
		return this.preferences;
		
	}
    public void setScenarioPreferences(){
    	
    	if(!dynamicEffect&&!staticEffect&&!implementationalChange&&!semanticChange){
    	preferences.add(Scenario.LONELYCLASSLONELYINTERFACE);
    	preferences.add(Scenario.LONELYCLASSNOINTERFACE);
    	preferences.add(Scenario.JOINTCLASSLONELYINTERFACE);
    	preferences.add(Scenario.LONELYCLASSJOINTINTERFACE);
    	preferences.add(Scenario.JOINTCLASSJOINTINTERFACE);
    	preferences.add(Scenario.JOINTCLASSNOINTERFACE);
    	}
    	else if(dynamicEffect){
    		if(implementationalChange){
    			this.serverCoefficient = 2.0;
    			preferences.add(Scenario.LONELYCLASSLONELYINTERFACE);
    	    	preferences.add(Scenario.LONELYCLASSNOINTERFACE);
    	    	preferences.add(Scenario.JOINTCLASSLONELYINTERFACE);
    	    	preferences.add(Scenario.LONELYCLASSJOINTINTERFACE);
    	    	preferences.add(Scenario.JOINTCLASSJOINTINTERFACE);
    	    	preferences.add(Scenario.JOINTCLASSNOINTERFACE);

    		}
    	}
    	else if(staticEffect){
    		if(implementationalChange){
    			preferences.add(Pattern.STRATEGY);
    		   	preferences.add(Scenario.LONELYCLASSLONELYINTERFACE);
    	    	preferences.add(Scenario.LONELYCLASSNOINTERFACE);
    	    	preferences.add(Scenario.JOINTCLASSLONELYINTERFACE);
    	    	preferences.add(Scenario.LONELYCLASSJOINTINTERFACE);
    	    	preferences.add(Scenario.JOINTCLASSJOINTINTERFACE);
    	    	preferences.add(Scenario.JOINTCLASSNOINTERFACE);

    		}else if(semanticChange){
    			this.proxyCoefficient = 3.0;
    		   	preferences.add(Scenario.LONELYCLASSLONELYINTERFACE);
    	    	preferences.add(Scenario.LONELYCLASSNOINTERFACE);
    	    	preferences.add(Scenario.JOINTCLASSLONELYINTERFACE);
    	    	preferences.add(Scenario.LONELYCLASSJOINTINTERFACE);
    	    	preferences.add(Scenario.JOINTCLASSJOINTINTERFACE);
    	    	preferences.add(Scenario.JOINTCLASSNOINTERFACE);

    		}
    	}
    }
}

